{% extends "openvolunteer/base.html" %}

{% block title %}OpenVolunteer | Édition d'une fiche{% endblock %}

{% block content %}
    <form method="POST" action="." class="edit-form center">
        <table class="centered">
            <tr>
                <th>Événement</th>
                <td class="required">{{ answer.event }}</td>
            </tr>
            <tr>
                <th>Bénévole</th>
                <td class="required">
                    <select id="id_volunteer" name="volunteer">
                        <option value="">----</option>
                        {{ sel_opts_vol|safe }}
                    </select>
                </td>
            </tr>
            <tr>
                <th>Poste</th>
                <td>
                    <select id="id_job" name="job">
                        <option value="">----</option>
                        {{ sel_opts_job|safe }}
                    </select>
                </td>
            </tr>
            <tr>
                <th>Présence</th>
                <td>
                    <select id="id_presence" name="presence">
                        <option value="maybe" {% ifequal answer.presence 'maybe'%}selected="selected"{% endifequal %}>Peut-être</option>
                        <option value="yes"   {% ifequal answer.presence 'yes'%}selected="selected"{% endifequal %}  >Oui</option>
                        <option value="no"    {% ifequal answer.presence 'no'%}selected="selected"{% endifequal %}   >Non</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th>Dernière demande</th>
                <script type="text/javascript">
                    function autoToday() {
                        var d=new Date();
                        document.getElementById('id_last_request_day').value = d.getDate();
                        document.getElementById('id_last_request_month').value = d.getMonth() + 1;
                        document.getElementById('id_last_request_year').value = d.getFullYear();
                    }
                </script>
                <td>
                    <input type="text" id="id_last_request_day" maxlength="2" size="2"
                           name="lastrequest_day" value='{{ answer.last_request|date:"d" }}'>
                    <input type="text" id="id_last_request_month" maxlength="2" size="2"
                           name="lastrequest_month" value='{{ answer.last_request|date:"m" }}'>
                    <input type="text" id="id_last_request_year" maxlength="4" size="4"
                           name="lastrequest_year" value='{{ answer.last_request|date:"Y" }}'>
                    <br>
                    (<a href="javascript:;" onclick="autoToday();">Aujourd'hui</a>)
                </td>
            </tr>
            <tr>
                <th>Commentaires</th>
                <td colspan="3">
                    <textarea id="id_comments" name="comments">{{ answer.comments }}</textarea>
                </td>
            </tr>
        </table>
        <p class="required">* Les champs marqués en <span>rouge</span> sont obligatoires.</p>
        <input type="submit" value="Enregistrer">
    </form>
{% endblock %}

{% block navigation %}
    <ul>
       </li><a href="{{ answer.event.get_answer_url }}" title="">Accéder à la liste des réponses</a></li>
    </ul>
{% endblock %}
